package cn.thornbird.orgsync.repository;

import cn.thornbird.orgsync.entity.Company;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface CompanyRepository extends BaseRepository<Company>, JpaRepository<Company, String>,
        JpaSpecificationExecutor<Company> {

    Long countByActive(Boolean active);

    Company findFirstByNameIgnoreCaseAndCityIdIsNull(String name);

    Company findFirstByCityIdAndNameIgnoreCase(String cityId, String name);

    List<Company> findAllByIdIn(List<String> ids);

}
